
module DataTypes where

import Data.Binary
import Data.Time.LocalTime
import Data.Time.Calendar
import Data.Time.Format

-- Node in the train connections graph
data GraphNode = GraphNode { 
                              station :: Station,
                              trains :: [Train]
                           } deriving (Show, Read, Eq)

-- Train might go Forward or Backward
data Direction = Forward | Backward
                 deriving (Show, Read, Eq)

-- Typical station has its name (e.g. Warszawa Wesola) and
-- is located in some city (Warszawa)
data Station = Station  {
                            id :: Int,
                            stationName :: String,
                            city :: String
                        } deriving (Show, Read, Eq)

-- Typical schedule information             
data DeparturesItem = DeparturesItem {
                                arrival :: LocalTime,
                                departure :: LocalTime,
                                stationId :: Int,
                                direction :: Direction
                             } deriving (Show, Read, Eq)
                             
-- Representation of the train
data Train = Train  {
                        name :: String,                        
                        since :: Day,
                        till :: Day,
                        -- 1st list is forward route, 2nd is backward, each list consists of station ids
                        route :: ([Int], [Int]), 
                        sched :: [([DeparturesItem], [DeparturesItem])]
                    } deriving (Show, Read, Eq)

